//
//  ZYHttpSessionManager.h
//  ZYWebImage
//
//  Created by wangzhipan on 2025/4/1.
//

#import <Foundation/Foundation.h>
#import "ZYNetworkMacros.h"
#import "ZYHTTPResponseSerializer.h"
#import "ZYHTTPRequestSerializer.h"
#import "ZYUrlSessionManager.h"

NS_ASSUME_NONNULL_BEGIN

@interface ZYHttpSessionManager : ZYUrlSessionManager
@property (nonatomic, strong, nullable, readonly) NSURL *baseUrl;
@property (nonatomic, strong) ZYHTTPRequestSerializer *requestSerializer;
+ (instancetype)manager;

- (instancetype)initWithBaseURL:(nullable NSURL *)baseUrl;

- (instancetype)initWithBaseURL:(nullable NSURL *)url
           sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration;

- (nullable NSURLSessionTask *)GET:(NSString *)urlStr
                            params:(nullable NSDictionary *)params
                           headers:(nullable NSDictionary<NSString *, NSString *> *)headers
                           success:(ZYSuccessBlock)success
                           failure:(ZYFailureBlock)failure;

- (nullable NSURLSessionTask *)POST:(NSString *)urlStr
                             params:(nullable NSDictionary *)params
                            headers:(nullable NSDictionary<NSString *, NSString *> *)headers
                            success:(ZYSuccessBlock)success
                            failure:(ZYFailureBlock)failure;

- (nullable NSURLSessionTask *)HEAD:(NSString *)urlStr
                             params:(nullable NSDictionary *)params
                            headers:(nullable NSDictionary<NSString *, NSString *> *)headers
                            success:(ZYSuccessBlock)success
                            failure:(ZYFailureBlock)failure;

//上传小文件
- (nullable NSURLSessionTask *)upload:(NSString *)urlStr
                                 name:(NSString *)name
                             fileName:(NSString *)fileName
                             mimeType:(NSString *)mimeType
                                 data:(NSData *)data
                               params:(nullable NSDictionary<NSString *, NSString *> *)params
                        progressBlock:(ZYProgressBlock)progressBlock
                              success:(ZYSuccessBlock)success
                              failure:(ZYFailureBlock)failure;

//上传大文件
- (nullable NSURLSessionTask *)upload:(NSString *)urlStr
                                 name:(NSString *)name
                             fileName:(NSString *)fileName
                             mimeType:(NSString *)mimeType
                              fileUrl:(NSURL *)fileUrl
                               params:(nullable NSDictionary<NSString *, NSString *> *)params
                        progressBlock:(ZYProgressBlock)progressBlock
                              success:(ZYSuccessBlock)success
                              failure:(ZYFailureBlock)failure;
/*
 常见的 MIME 类型：

 - 图片： image/jpeg , image/png , image/gif
 - 文档： application/pdf , application/msword
 - 视频： video/mp4 , video/quicktime
 - 音频： audio/mpeg , audio/wav
 */
@end

NS_ASSUME_NONNULL_END
